<?php
	 require 'pais.php';
        $yhendus=new mysqli("localhost", "if13", "ifikad", "if13_maaskca");
        $kask=$yhendus->prepare("SELECT id, eesnimi, perekonnanimi, email from isikud;");
    $kask->bind_result($id, $eesnimi,$perenimi,$email);
    $kask->execute();
       
       
        echo"<table border='2'><tr><th>ID</th><th>Eesnimi</th><th>Perekonnna nimi</th><th>email</th></tr>";
        while($kask->fetch()){
                echo"<tr><td>$id</td><td>$eesnimi</td><td>$perenimi</td><td>$email</td><td><a href='?kustutasid=$id'>kustuta</a></td></tr>";
        }
        if(isSet($_REQUEST["kustutasid"])){
                $kask=$yhendus->prepare("DELETE FROM isikud WHERE id=?");
                $kask->bind_param("i",$_REQUEST["kustutasid"]);
                $kask->execute();
                }
        $yhendus->close();
?>
